<template>
  <div class="system-settings">
    <!-- 热门设置 -->
    <div class="hot-settings">
      <el-button type="text" size="small" style="margin-right: 10px;">
        <i class="el-icon-delete"></i> 清除数据
      </el-button>
      <el-button type="text" size="small" style="margin-right: 10px;">
        <i class="el-icon-time"></i> 管理 Cookie
      </el-button>
      <el-button type="text" size="small" style="margin-right: 10px;">
        <i class="el-icon-edit"></i> 自定义主题
      </el-button>
      <el-button type="text" size="small">
        <i class="el-icon-download"></i> 下载位置
      </el-button>
    </div>

    <!-- 个人资料 -->
    <div class="profile-card">
      <div class="profile-header">
        <div class="avatar">
          <img src="../assets/1.jpg" alt="头像" />
        </div>
        <div class="info">
          <div class="id">8613037506793</div>
        </div>
        <div class="actions">
          <el-button icon="el-icon-edit" size="mini" circle></el-button>
          <el-button icon="el-icon-delete" size="mini" circle></el-button>
          <el-button type="primary" size="mini">登录</el-button>
        </div>
      </div>

      <div class="profile-footer">
        <el-button type="text" style="padding: 0;">
          <i class="el-icon-user"></i> 管理帐户
        </el-button>
        <el-button type="text" style="float: right;">
          <i class="el-icon-share"></i>
        </el-button>
      </div>
    </div>

    <!-- 个人资料设置 -->
    <div class="settings-list">
      <div class="title">个人资料设置</div>
      <p class="desc">设置你中的配置文件</p>

      <div class="setting-item" v-for="(item, index) in settings" :key="index" @click="toggleItem(index)">
        <div class="item-left">
          <i :class="item.icon"></i>
          <span>{{ item.label }}</span>
        </div>
        <i class="el-icon-arrow-right" v-if="!item.opened"></i>
        <i class="el-icon-arrow-down" v-else></i>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      settings: [
        { label: '同步内容', icon: 'el-icon-refresh', opened: false },
        { label: '信息列表', icon: 'el-icon-tickets', opened: false },
        { label: '导入数据', icon: 'el-icon-upload', opened: false },
        { label: '配置偏好', icon: 'el-icon-setting', opened: false },
        { label: '共享数据', icon: 'el-icon-menu', opened: false },
        { label: '工作区域', icon: 'el-icon-s-custom', opened: false }
      ]
    }
  },
  methods: {
    toggleItem(index) {
      this.settings[index].opened = !this.settings[index].opened
    }
  }
}
</script>

<style scoped>
.system-settings {
  padding: 20px;
  font-size: 14px;
  color: #333;
}

.hot-settings {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hot-settings .el-button {
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 8px 12px;
  background: white;
  color: #666;
  cursor: pointer;
}

.hot-settings .el-button:hover {
  background: #f5f7fa;
  border-color: #b3d8ff;
}

.profile-card {
  border: 1px solid #ebeef5;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
  background: white;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info {
  margin-left: 16px;
}

.info .name {
  font-weight: bold;
  font-size: 16px;
}

.info .id {
  color: #999;
  font-size: 14px;
}

.info .status {
  color: #999;
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 8px;
}

.profile-message {
  color: #999;
  font-size: 14px;
  margin: 16px 0;
  line-height: 1.6;
}

.profile-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #ebeef5;
}

.settings-list {
  border: 1px solid #ebeef5;
  border-radius: 8px;
  padding: 20px;
  background: white;
}

.settings-list .title {
  font-weight: bold;
  margin-bottom: 8px;
}

.settings-list .desc {
  color: #999;
  font-size: 14px;
  margin-bottom: 16px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #ebeef5;
  cursor: pointer;
  transition: background 0.2s;
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-item:hover {
  background: #f5f7fa;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-item i {
  font-size: 16px;
  color: #666;
}
</style>